package Test;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.Vector;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

import Config.Configure;
import Config.GlobalLog;
import EurekaAnalyzer.IDInformation;
import Statistics.IDGraph;
import Statistics.IDGraphGlobalProperty;
import Statistics.IDGraphNode;
import Statistics.IDGraphToJungGraph;
import Store.StoreManager;
import EurekaProcessor.Clusterer;
import GUI.DataFrontier;

import java.util.Scanner;
public class TestClusterer2 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Configure.SetConfigureFile("D:/workspace/amoamo/trunk/TestData/TestPMgr/TestPipeLineMgr");
		try {
			Configure.GetConfigure();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		DataFrontier df = new DataFrontier();
		IDGraph graph = df.GetIDGraph();
		
		System.out.println(graph.GetNodeMap().get("KMZ").GetInDegree() + graph.GetNodeMap().get("KMZ").GetOutDegree());

		Set<Set<String>> clusters = Clusterer.HierarchicalClusteringFast(graph, 1000);
		List<Set<String>> list = new ArrayList<Set<String>>(clusters);

		for(int i = 0; i < clusters.size(); i++)
		{
			System.out.print("Set " + i + "(" + list.get(i).size() + ")" + ": ");
			List<String> members = new ArrayList<String>(list.get(i));
			for(int j = 0; j < members.size(); j++)
				System.out.print(members.get(j) + " ");
			System.out.println();
		}

	}

}
